package com.design.pattern.memo;

import java.util.ArrayList;
import java.util.List;

/**
 * 管理者
 */
public class Caretaker {
    List<CheckerBoardMemoIF> pieces=new ArrayList<>();

    /**
     * 保存备份
     * @param checkerBoardMemoIF
     */
    public void savePieceMemo(CheckerBoardMemoIF checkerBoardMemoIF){
        pieces.add(checkerBoardMemoIF);
    }

    /**
     * 获取备份状态
     * @return
     */
    public CheckerBoardMemoIF getLast(){
        return pieces.size()>0? pieces.get(pieces.size()-1):null;
    }
}
